/*
    main.me -- Main MakeMe File for Appweb
 */

Me.load({
    makeme: '>=0.9.0',

    plugins: [ 'installs' ],

    blend: [
        'src/*.me',
        'src/*/*.me',
        'doc/doc.me',
        'test/test.me',
        'samples/samples.me',
        'installs/installs.me',
        '?local.me',
    ],

    modules: [ 'installs/service.es' ],

    configure: {
        requires:  [ 'osdep', 'http', 'mpr', 'pcre'],
        discovers: [ 'esp', 'mdb', 'ssl', 'watchdog' ],
        extras:    [ 'cgi', 'dir', 'ejs', 'php' ],
    },

    customize: [
        /* 
            The optional custom.me file is loaded after main.me is fully processed. It can
            thus override any setting. Feel free to create and customize. 
         */
        'custom.me',
    ],

    settings: {
        integrate: true,

        /*
            Installation prefix set
         */
        prefixes: 'install-prefixes',
        manifest: 'installs/manifest.me',

        /*
            Name and path of the appweb config file. Defaults to './appweb.conf' if empty.
         */
        configFile: 'appweb.conf',

        /* Must build locally to build tools */
        platforms: [ 'local' ],

        certs: {
            gendh: true
        },

        compiler: {
            fortify: true,
        },

        ejscript: {
            db: true,                                                                                     
            mail: true,                                                                                   
            mapper: true,                                                                                 
            shell: true,
            tar: true,                                                                                     
            template: true,                                                                               
            web: true,                                                                                    
            zlib: true,
        },

        esp: {
            cmd:    true,
            legacy: false,
            module: false,
        },

        http: {
            /* Use PAM (Plugable Authentication Module) to store passwords */
            cmd: true,
            pam: true,
            webSockets: true,
        },

        mbedtls: {
            compact: true,      /* Compact edition - Disable non-essential ciphers and features */
        },

        mpr: {
            /*
                Enable logging via mprLog to the log file
                The default is to enable logging for both debug and release builds.
             */
            logging: true,              /* Enable application logging */
            romMount: "/rom",           /* Virtual mount point for a rom file system */
            threadStack: 0,             /* Use the default system stack size */
            oslog: false,               /* Write to the O/S log file */

            alloc: {
                // quota: 204800,       /* Amount of memory to allocate before a GC */
                // cache: 0,            /* Amount of memory to buffer for fast allocations */
                // check: false,        /* Memory allocation debug and stats (slow) */
            },
            ssl: {
                cache: 512,             /* Set the session cache size (items) */
                logLevel: 5,            /* Starting logging level for SSL messages */
                handshakes: 1,          /* Set maximum number of renegotiations (zero means infinite) */
                ticket: true,           /* Enable session resumption via ticketing - client side session caching */
                timeout: 86400,         /* Session and ticketing duration in seconds */
            },
        },

        /*
            Build without a file system (from ROM)
         */
        rom: false,

        watchdog: {
            name: 'appman',
        },

        /*
            Tailor the optimization for size|balanced|speed
         */
        tune: 'size',

        /*
            Initial home directory for the server
         */
        serverRoot: '.',
    },

    usage: {
        'configFile':           'Path of the appweb.conf file',
        'http.pam':             'Enable Unix Pluggable Auth Module (true|false)',
        'http.webSockets':      'Enable WebSockets (true|false)',                
        'mpr.logging':          'Enable application logging (true|false)',
        'serverRoot':           'Home directory for the server ',
    },

    targets: {
        cgi: {
            configurable: true,
            description: 'Common Gateway Interface Module',
            path: 'src/modules/cgiHandler.c',
            depends: [ 'libmod_cgi' ],
        },

        dir: {
            configurable: true,
            description: 'Directory Listing Module',
        },

        /*
            See src/server/server.me for the appweb targets
            See src/libappweb.me for the appweb library target
            See installs/installs.me for the install targets
         */
        projects: {
            action: `genProjects('')`,
        },

        mine: {
            action: `genProjects('', 'mine', Config.OS + '-' + Config.CPU)`,
        }
    },

    usage: {
        'rom':          'Build without a file system (true|false)',
    }
})
